package cc.vv.btpartyjob.partymanager.delegate

import android.text.TextUtils
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.btpartyjob.partymanager.R
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 单元中心户托管类
 * Created by Chen.qi on 2018/10/24.
 */
class UnitHouseDetailActivityDelegate : BaseAppDelegate() {


    override fun initWidget() {
    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_unit_house_detial
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_auHd_topBar)
        titleBar?.setTitle(topBarTitle)
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_auHd_topBar)
        titleBar?.setEventInterface(event)
    }

    /**
     * 楼栋名称
     */
    fun setLouDongUnitName(name: String?) {
        val viewZX = getView<TextView>(R.id.tv_uhd_louDongTeamName)
        viewZX?.text = name
    }

    /**
     * 中心户名称
     */
    fun setZhongXinHuName(name: String?) {
        val viewZX = getView<TextView>(R.id.tv_auHd_unitHouseName)
        viewZX?.text = name
    }

    /**
     * 中心户位置
     */
    fun setZhongXinHuAddress(address: String?) {
        val llAdd = getView<LinearLayout>(R.id.ll_auHd_address)
        if (TextUtils.isEmpty(address)) {
            llAdd?.visibility = View.GONE
        } else {
            llAdd?.visibility = View.VISIBLE
            val viewZX = getView<TextView>(R.id.tv_auHd_unitHouseLocation)
            viewZX?.text = address
        }
    }

    /**
     * 联系人姓名
     */
    fun setLianXiRenName(name: String?) {
        val linMan = getView<LinearLayout>(R.id.tv_auHd_linkMan)
        if (TextUtils.isEmpty(name)) {
            linMan?.visibility = View.GONE
        } else {
            linMan?.visibility = View.VISIBLE
            val viewZX = getView<TextView>(R.id.tv_auHd_unitHouseLikeMan)
            viewZX?.text = name
        }
    }


    /**
     * 联系人姓名
     */
    fun setLianXiRenPhone(phone: String?) {
        val viewZX = getView<TextView>(R.id.tv_auHd_unitHouseLikeTel)
        viewZX?.text = phone
    }
}